const getIpAddress = require('../utils/getIpAddress');

const getBasePath = async (ctx, next) => {
  let ip = getIpAddress();
  global.basePath = ctx.protocol === 'https' ?
    `https://${ip}:${global.portS}/users`
    :
    `http://${ip}:${global.port}/users`;
  await next();
}

module.exports = getBasePath;